class Person{
    private String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
        this.eat();
    }
  /*  public String getName(){
        return this.name;
    }
    //这两个是公开的接口
    public void setName(String name){
        this.name =name;
    }*/

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    private void eat(){
        System.out.println("吃饭！");
    }
    public void show(){
        System.out.println(name+" "+age);
    }
}

public class Test {
    public static void main(String[] args) {
        Person person = new Person("zhangsan",20);
        /*person.show();
        person.name = "zhangsan";
        person.eat();*/
        person.setName("lisi");
        person.show();
    }
}
